package com.example.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.example.base.Cache.Cacheable;
import com.example.base.model.BaseEntity;

@Entity
@Table(name = "machine")
public class Machine extends BaseEntity implements Serializable, Cacheable {

    private static final long serialVersionUID = 7839360591402891632L;

    public final static Integer STATUS_NEW = 1;//新建

    public final static Integer STATUS_SELL = 2;//已售

    public final static Integer STATUS_ACTIVE = 3;//已激活

    public final static Integer STATUS_FROZEN = 4;//冻结

    public final static Integer STATUS_MAINTAIN = 5;//维修

    public final static Integer STATUS_BROKEN = 6;//报废

    public final static Integer STATUS_REMOVE = 7;//移除

    public final static Integer STATUS_RETURN = 8;//返厂换货

    public final static Integer STATUS_RETURN_CHANGE_IMEI = 9;//返厂换imei

    public final static Integer STATUS_FACTORY_RECOVERY = 10;//工厂回收
    
    public final static Integer STATUS_RETURN_GOODS = 11;//退货

    public final static Integer USER_STATUS_START = 1;// 启用

    public final static Integer USER_STATUS_STOP = 2;// 停 用

    public final static Integer CLASSIFICATION_NEW = 1;// 新设备

    public final static Integer CLASSIFICATION_OLD = 2;// 旧设备

    public final static Integer REC_STATUS_NORMAL = 0;// 正常

    public final static Integer REC_STATUS_DELETE = 1;// 删除


    @Column(name = "imei")
    private String imei;// 设备的标识

    @Column(name = "name")
    private String name;// 设备的标识

    @Column(name = "status")
    private Integer status = 1;// 状态（1：新建 2：已售 3：已激活4：冻结5：维修6：报废7:移除8:返厂）

    @Column(name = "user_id")
    private Integer userId;// 用户的主键ID

    @Column(name = "activation_time")
    private Date activationTime;// 激活时间

    @Column(name = "alias")
    private String alias;// 别名

    @Column(name = "hw_version")
    private Integer hwVersion;// 1普通版2专业版3企业版

    @Column(name = "sw_version")
    private String swVersion;// 软件版本

    @Column(name = "price")
    private Float price;// 价格

    @Column(name = "provider")
    private Boolean provider;// 厂家

    @Column(name = "freeze_time")
    private Date freezeTime;// 冻结时间

    @Column(name = "unfreeze_time")
    private Date unfreezeTime;// 解冻时间

    @Column(name = "registration_id")
    private String registrationId;// 注册id

    @Column(name = "sell_agent_id")
    private Integer sellAgentId;// 代理商ID

    @Column(name = "user_status", insertable = false)
    private Integer userStatus;// 用户设置状态(1:启用2:停用)默认1

    @Column(name = "communication_status")
    private Integer communicationStatus;// 通讯状态(1:通讯正常 2:正在运行中 3:通讯异常)默认1

    @Column(name = "start_count")
    private Integer startCount;// 启动次数

    @Column(name = "sell_partner_id")
    private Integer sellPartnerId;// 销售合伙人ID

    @Column(name = "group_type")
    private Integer groupType = 0;// 分组

    @Column(name = "product_type")
    private Integer productType;// 设备类型 1：平板 2：手机

    @Column(name = "version_type")
    private Integer versionType;// 系统版本类型：1电商机器人2商务助理

    @Column(name = "product_id")
    private Integer productId;//产品id

    @Column(name = "storage_id")
    private Integer storageId;//库存id

    @Column(name = "product_describe")
    private String productDescribe;//产品描述

    @Column(name = "device_id")
    private String deviceId;// 阿里云设备id

    @Column(name = "purchaser")
    private Integer purchaser;//购买人

    @Column(name = "classification")
    private Integer classification;//设备分类（1.新设备2.旧设备）

    @Column(name = "code")
    private String code;//邀请码

    @Column(name = "share_type")
    private Integer shareType;//是否分销设备（1 是）
    
    @Column(name = "desktop_type")
    private Integer desktopType;//桌面类型（1 三个微信号 2 十个微信号）

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getSellAgentId() {

        return sellAgentId;
    }

    public void setSellAgentId(Integer sellAgentId) {

        this.sellAgentId = sellAgentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImei() {

        return this.imei;
    }

    public void setImei(String imei) {

        this.imei = imei;
    }

    public Integer getStatus() {

        return this.status;
    }

    public void setStatus(Integer status) {

        this.status = status;
    }

    public Integer getUserId() {

        return this.userId;
    }

    public void setUserId(Integer userId) {

        this.userId = userId;
    }

    public Date getActivationTime() {

        return this.activationTime;
    }

    public void setActivationTime(Date activationTime) {

        this.activationTime = activationTime;
    }

    public String getAlias() {

        return this.alias;
    }

    public void setAlias(String alias) {

        this.alias = alias;
    }

    public Integer getHwVersion() {

        return this.hwVersion;
    }

    public void setHwVersion(Integer hwVersion) {

        this.hwVersion = hwVersion;
    }

    public String getSwVersion() {

        return this.swVersion;
    }

    public void setSwVersion(String swVersion) {

        this.swVersion = swVersion;
    }

    public Float getPrice() {

        return this.price;
    }

    public void setPrice(Float price) {

        this.price = price;
    }

    public Boolean getProvider() {

        return this.provider;
    }

    public void setProvider(Boolean provider) {

        this.provider = provider;
    }

    public Date getFreezeTime() {

        return this.freezeTime;
    }

    public void setFreezeTime(Date freezeTime) {

        this.freezeTime = freezeTime;
    }

    public Date getUnfreezeTime() {

        return this.unfreezeTime;
    }

    public void setUnfreezeTime(Date unfreezeTime) {

        this.unfreezeTime = unfreezeTime;
    }

    public String getRegistrationId() {

        return this.registrationId;
    }

    public void setRegistrationId(String registrationId) {

        this.registrationId = registrationId;
    }

    public Integer getUserStatus() {

        return this.userStatus;
    }

    public void setUserStatus(Integer userStatus) {

        this.userStatus = userStatus;
    }

    public Integer getCommunicationStatus() {

        return this.communicationStatus;
    }

    public void setCommunicationStatus(Integer communicationStatus) {

        this.communicationStatus = communicationStatus;
    }

    public Integer getStartCount() {

        return this.startCount;
    }

    public void setStartCount(Integer startCount) {

        this.startCount = startCount;
    }

    public Integer getSellPartnerId() {

        return sellPartnerId;
    }

    public void setSellPartnerId(Integer sellPartnerId) {

        this.sellPartnerId = sellPartnerId;
    }

    public Integer getGroupType() {

        return groupType;
    }

    public void setGroupType(Integer groupType) {

        this.groupType = groupType;
    }

    public Integer getProductType() {

        return productType;
    }

    public void setProductType(Integer productType) {

        this.productType = productType;
    }

    public Integer getVersionType() {

        return versionType;
    }

    public void setVersionType(Integer versionType) {

        this.versionType = versionType;
    }

    @Override
    public String cacheKey() {

        return getId().toString();
    }

    public Integer getProductId() {

        return productId;
    }

    public void setProductId(Integer productId) {

        this.productId = productId;
    }

    public Integer getStorageId() {
        return storageId;
    }

    public void setStorageId(Integer storageId) {
        this.storageId = storageId;
    }

    public String getProductDescribe() {

        return productDescribe;
    }

    public void setProductDescribe(String producDescribe) {

        this.productDescribe = producDescribe;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public Integer getPurchaser() {
        return purchaser;
    }

    public void setPurchaser(Integer purchaser) {
        this.purchaser = purchaser;
    }

    public Integer getClassification() {
        return classification;
    }

    public void setClassification(Integer classification) {
        this.classification = classification;
    }

    public Integer getShareType() {
        if (shareType == null) {
            return 0;
        }
        return shareType;
    }

    public void setShareType(Integer shareType) {
        this.shareType = shareType;
    }
    
	public Integer getDesktopType() {
		return desktopType;
	}

	public void setDesktopType(Integer desktopType) {
		this.desktopType = desktopType;
	}

	@Override
    public String toString() {
        return "Machine{" +
                "imei='" + imei + '\'' +
                ", name='" + name + '\'' +
                ", status=" + status +
                ", userId=" + userId +
                ", activationTime=" + activationTime +
                ", alias='" + alias + '\'' +
                ", hwVersion=" + hwVersion +
                ", swVersion='" + swVersion + '\'' +
                ", price=" + price +
                ", provider=" + provider +
                ", freezeTime=" + freezeTime +
                ", unfreezeTime=" + unfreezeTime +
                ", registrationId='" + registrationId + '\'' +
                ", sellAgentId=" + sellAgentId +
                ", userStatus=" + userStatus +
                ", communicationStatus=" + communicationStatus +
                ", startCount=" + startCount +
                ", sellPartnerId=" + sellPartnerId +
                ", groupType=" + groupType +
                ", productType=" + productType +
                ", versionType=" + versionType +
                ", productId=" + productId +
                ", storageId=" + storageId +
                ", productDescribe='" + productDescribe + '\'' +
                ", deviceId='" + deviceId + '\'' +
                ", purchaser=" + purchaser +
                ", classification=" + classification +
                ", code='" + code + '\'' +
                '}';
    }
}
